package modeling;

import utilities.PDButility;


/**
 * @author Mathieu Rousseau
 * @email mathieu.rousseau3@mail.mcgill.ca
 */


/** ------------------------------------------------------------------------------------------------------------------
 * start of ZoomStructure class
 * ------------------------------------------------------------------------------------------------------------------  */
public class ZoomStructure {

	
	/*  start of main method  */
	public static void main(String[] args) {
		
		
		
		
		//  NUMBER OF STRUCTURES  ------------------------------------------------
		int numberOfStructures = 500;
		System.out.println("Number of structures to zoom: " + numberOfStructures);
		//  ----------------------------------------------------------------------
		
		
		
		
		//  ZOOM FACTOR  --------------------------------
		double zoomFactor = 100;
		System.out.println("Zoom factor: " + zoomFactor);
		//  ---------------------------------------------
		
		
		
		PDButility pdb = new PDButility();
		
		String inputPath = "ZoomStructure/Input/";
		String outputPath = "ZoomStructure/Output/";
		
		
		for(int i=0; i<=numberOfStructures; i++){
			
			String filename = "";
			
			if(i<10){
				filename = "structure_000" + i + ".pdb";
			}
			else if(i<100){
				filename = "structure_00" + i + ".pdb";
			}
			else if(i <1000){
				filename = "structure_0" + i + ".pdb";
			}
			else{
				filename = "structure_" + i + ".pdb";
			}
			
			double[][] structure = pdb.getStructure(inputPath + filename);
			int numberOfPoints = pdb.getNumberOfPoints(inputPath + filename);
			
			for(int j=0; j<numberOfPoints; j++){
				structure[j][0] = structure[j][0] * zoomFactor;
				structure[j][1] = structure[j][1] * zoomFactor;
				structure[j][2] = structure[j][2] * zoomFactor;
			}
			
			pdb.writeStructure(outputPath + filename, structure, pdb.getHeader(inputPath + filename) + "\tZoomStructure[" + zoomFactor + "x]");
		}
		
		
		String bestStructureFilename = "best_structure.pdb";
		double[][] bestStructure = pdb.getStructure(inputPath + bestStructureFilename);
		int numberOfPoints = pdb.getNumberOfPoints(inputPath + bestStructureFilename);
		
		for(int j=0; j<numberOfPoints; j++){
			bestStructure[j][0] = bestStructure[j][0] * zoomFactor;
			bestStructure[j][1] = bestStructure[j][1] * zoomFactor;
			bestStructure[j][2] = bestStructure[j][2] * zoomFactor;
		}
		
		pdb.writeStructure(outputPath + bestStructureFilename, bestStructure, pdb.getHeader(inputPath + bestStructureFilename) + "\tZoomStructure[" + zoomFactor + "x]");
		
		System.out.println("Done!");
	}/*  end of main method  */
}/*  end of ZoomStructure class  */
